﻿Public Class Frm5RolesNuevos

    Private Sub BtnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAceptar.Click
        'Clase Roles
        Dim dato As New Roles
        'Clase Operaciones
        Dim accion As New rolesDAO
        'Asignar los datos
        If txtRoles.Text = String.Empty Then
            ErrorProvider1.SetError(txtRoles, "Debe de ingresar el rol")
        Else
            ErrorProvider1.SetError(txtRoles, "")
            dato.pDescrip = txtRoles.Text
            'Agregar registro
            If accion.agregar(dato) Then
                MessageBox.Show("Registro almacenado", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Information)
                Frm5RolesMenu.Show()
                Me.Close()
            Else
                MessageBox.Show("No se puede guardar el registro, contacte al administrador", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            End If

        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Frm5RolesMenu.Show()
        Me.Close()
    End Sub
End Class